﻿@namespace MudBlazor
@inherits MudBaseSelectItem
@using Microsoft.AspNetCore.Components.Routing

<div @attributes="UserAttributes" class="@Classname" disabled="@Disabled" style="@Style">
    @if (!OnClick.HasDelegate && Command == null)
    { 
        <NavLink @onclick="@HandleNavigation" 
                 class="@LinkClassname" 
                 @attributes="@Attributes"
                 Match="@Match" 
                 ActiveClass="active">
            @if (!string.IsNullOrEmpty(Icon))
            {
                <MudIcon Icon="@Icon" Color="@IconColor" Class="@IconClassname"/>
            }
            <div class="mud-nav-link-text">
                @ChildContent
            </div>
        </NavLink>
    }
    else
    {
        <div @onclick="OnClickHandler"
             class="@LinkClassname"
             ActiveClass="active">
            @if (!string.IsNullOrEmpty(Icon))
            {
                <MudIcon Icon="@Icon" Color="@IconColor" Class="@IconClassname" />
            }
            <div Class="mud-nav-link-text">
                @ChildContent
            </div>
        </div>
    }
</div>